<?php
class ml_tool_async
{
    public function tuiguang_log($wbuid , $url ,$mluid = 0 , $tInfo = array() , $ufrom = 'weibo')
    {
        $oAsync = self::_init_async('tuiguang_log');
        $msg_data = array(
            'wbuid' => $wbuid,
            'url' => $url,
            'mluid' => $mluid,
            'Utime' => time(),
            'Ufrom' => $ufrom,
            'mysite' => 'meila',
        );
        if(is_array($tInfo) && !empty($tInfo))
        {
            $msg_data += $tInfo;
        }
        //Tool_logger::debugLog(__CLASS__ , json_encode($msg_data));
        $res = $oAsync -> add('tuiguang_log'
                                    ,$msg_data
                                    ,Tool_ip::get_real_ip()
                                    ,Tool_ip::getLocalLastIp()
                                    ,$url
                                    ,'meila_web');
    }
    public function wx_action_log($log , $url)
    {
        $oAsync = self::_init_async('tuiguang_log');
        $res = $oAsync -> add('ml_action_log'
                                    ,$log
                                    ,Tool_ip::get_real_ip()
                                    ,Tool_ip::getLocalLastIp()
                                    ,$url
                                    ,'meila_web');
    }
    
    private function _init_async($name)
    {
        $conf = ml_factory::load_standard_conf('async');
        $conf = $conf[$name];
        return new Lib_asyncSender($conf,$pack_method='json');
    }
}